﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using E4D.AppFabric.Entities.Engine;
using System.Collections.ObjectModel;
using System.Management.Automation;

namespace UnitTests.Mocks
{
    class MockSessionFactory : ISessionFactory
    {
        private IList<Command> executedCommands = new List<Command>();
        private IDictionary<String, Collection<PSObject>> response = new Dictionary<String, Collection<PSObject>>();

        public IList<Command> ExecutedCommands { get { return executedCommands; } }
        public IDictionary<String, Collection<PSObject>> Response { get { return response; } }

        public MockSessionFactory()
        {

        }

        public MockSessionFactory(IList<Command> executedCommands)
        {
            this.executedCommands = executedCommands;
        }

        public MockSessionFactory(IList<Command> executedCommands, IDictionary<String, Collection<PSObject>> response)
        {
            this.executedCommands = executedCommands;
            this.response = response;
        }

        public void Clear()
        {
            executedCommands.Clear();
        }

        public ISession getLocalSession()
        {
            return new MockSession(executedCommands, response);
        }

        public ISession getRemoteSesion(String hostName)
        {
            return new MockSession(executedCommands, response);
        }
    }
}
